//
//  MyLabel.m
//  UI-03 Homework 手势 响应者链
//
//  Created by 冀永金 on 16/7/18.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "MyLabel.h"

@implementation MyLabel
- ( nullable instancetype)initWithFrame:(CGRect)frame text:(nullable NSString *)text target:(nullable id)target action:(nullable SEL)action   backColor:(nullable UIColor *)backColor alpha:( CGFloat )alpha{
    self = [super initWithFrame:frame];
    if (self) {
        self.text = text;
        self.backgroundColor = backColor;
        self.alpha = alpha;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:target action:action];
        [self addGestureRecognizer:tap];
        self.userInteractionEnabled = YES;
    }
    return self;
}
+(__nullable instancetype)labelWithFrame:(CGRect)frame text:(nullable NSString *)text target:(nullable id)target action:(nullable SEL)action  backColor:(nullable UIColor *)backColor alpha:( CGFloat )alpha{
    return [[MyLabel alloc]initWithFrame:frame text:text target:target action:action backColor:backColor alpha:alpha];
}

//- (instancetype)initWithFrame:(CGRect)frame text:(nullable NSString *)text addGesture:(UITapGestureRecognizer *)tap action:(nullable SEL)action {
//    self = [super initWithFrame:frame];
//    if (self) {
//        self.text = text;
//        self.tap = tap;
//        self.action = action;
//    }
//    return self;
//}
//+ (instancetype)labelWithFrame:(CGRect)frame text:(nullable NSString *)text addGesture:(UITapGestureRecognizer *)tap action:(nullable SEL)action {
//    return [[MyLabel alloc]initWithFrame:frame text:text addGesture:tap action:action];
//}

@end
